<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<!-- 点击按钮,如果div是显示状态,就把div隐藏,否则把div显示出来 -->
<body>
  <div id="app">
    <div v-if="isVisible">小敏玩捉迷藏</div>
    <button @click="a">切换</button>
  </div>
</body>
<script src="./vue.js"></script>
<script>
  const { createApp,ref } = Vue;

  createApp({
    setup () {

      let isVisible = ref(true);

      function a () {
        if (isVisible.value) {
          isVisible.value = false;
        }else {
          isVisible.value = true;
        }
      }

      return {
        isVisible,
        a
      }
    }
  }).mount('#app');
</script>
</html>